package com.bw.liveplay.common.mvvm.viewmodel

import androidx.databinding.ObservableField
import com.bw.liveplay.common.entity.AddCommentEntity
import com.bw.liveplay.common.entity.BaseEntity
import com.bw.liveplay.common.mvvm.mondel.AddCommentModel
import com.bw.liveplay.common.network.LoadImage
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers

/**
 * @author KK
 * @description:
 * @date :2021/11/15 8:29
 *
 */
class AddCommentViewModel : BaseViewModel<AddCommentModel>() {
    public var text : ObservableField<String> = ObservableField()
    override fun result(t: BaseEntity) {
        if(t is AddCommentEntity){
            showMsg("添加评论成功了哟")
            finishPage()
        }
    }

    override fun initData() {


    }

    fun addcomment(){
        m.requestAddComment(text.get()!!,0,"https://c-ssl.duitang.com/uploads/item/202002/26/20200226230526_pooch.thumb.1000_0.jpg",1615197740457,0,"0",0)
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(this)
    }
}